//https://leetcode.cn/problems/letter-combinations-of-a-phone-number/

class Solution {
    string Arr[10] = { " "," ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
    void combine(string digits, int level, string combinestr, vector<string>& s)
    {
        //递归截止条件
        if (level == digits.size())
        {
            //将字符串存入vector
            s.push_back(combinestr);
            return;
        }
        //获取数字字符并转化为数字
        int num = digits[level] - '0';
        //获取对应的字符串
        string str = Arr[num];
        for (int i = 0; i < str.size(); i++)
        {
            combine(digits, level + 1, combinestr + str[i], s);
        }
    }
public:
    vector<string> letterCombinations(string digits) {
        vector<string> s;
        if (digits == "")
            return s;
        combine(digits, 0, "", s);
        return s;


    }
};